﻿using System;
using Beaker;

namespace OpenCube.Nbt.Mapping.Converters
{
	public sealed class DateTimeUnixLongConverter
		: NbtSimpleTypeConverter<DateTime, long>
	{
		protected override DateTime ConvertToModelValue(long nbtValue)
		{
			//  value is number of miliseconds sinds unix epoch of 1970-01-01
			return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(nbtValue);
		}

		protected override Maybe<long> ConvertToNbtValue(DateTime modelValue)
		{
			throw new NotImplementedException();
		}
	}
}
